﻿#include"sqlist.h"



typedef struct {
	int* elem;
	int length;
	int listsize;
}Sqlist;

int main()
{
	Sqlist A, B;
	int arr1[] = { 12,25,34,78,88,100 };
	int arr2[] = { 10,15,25,32,88 };
	if (InitSqlist<Sqlist, int, int>(A, InitListSize))
	{
		createsqlist<Sqlist, int>(A, arr1, sizeof(arr1) / sizeof(int));
	}
	if (InitSqlist<Sqlist, int, int>(B, InitListSize))
	{
		createsqlist<Sqlist, int>(B, arr2, sizeof(arr2) / sizeof(int));
	}
	Sqltravel<Sqlist, int>(A);
	Sqltravel<Sqlist, int>(B);
	cout << "================================================" << endl;
	int k = SqlistInsert<Sqlist, int, int>(A, 38, A.length);
	if (k) Sqltravel<Sqlist, int>(A);
	cout << "================================================" << endl;
	int e;
	int g = ListDelete_Sq<Sqlist, int, int>(B, 3, e);
	if (g) cout << "B中位序为3的数为：" << e << endl;
	cout << "此时B中的元素为：";
	Sqltravel<Sqlist, int>(B);
	cout << "================================================" << endl;
	cout << "请输入一个数字：";
	int num;
	cin >> num;
	int x = Sqlocate<Sqlist, int>(A, num);
	if (x > 0) cout << "该数字在A中的位序为：" << x << endl;
	else cout << "A中没有与该数字相等的元素" << endl;
	cout << "================================================" << endl;
	SqMergeList<Sqlist, int, int>(A, B, A);
	Sqltravel<Sqlist, int>(A);
	return OK;
}